package com.site.wisdom_construction.util.imgUtil;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/** @Author daiyifei @Date 2022/3/14 @Description */
public class ImgToBase64 {

  public static void convertFileToBase64(String imgPath) {
    byte[] data = null;
    // 读取图片字节数组
    try {
      InputStream in = new FileInputStream(imgPath);
      System.out.println("文件大小（字节）=" + in.available());
      data = new byte[in.available()];
      in.read(data);
      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
